package com.cwl.pattern.策略模式;

/**
 * @program: pattern
 * @description: 打折收费
 * @author: ChenWenLong
 * @create: 2019-06-24 13:58
 **/
public class CashRebate extends CashSuper {

    private Double moneyRebate =1D;
    /**
     * 使用构造器来进行初始化打折率,构造方法的好处就是当初始化这个类的时候就会初始化好当前这个类的字段
     *
     * @param moneyRebate
     */
    public CashRebate(String moneyRebate) {
        this.moneyRebate = Double.parseDouble(moneyRebate);
    }
    @Override
    public Double acceptCash(Double money) {
        return money *moneyRebate;
    }
}
